<?php
/**
 * Created by zhangyh.
 * User: zhangyh
 * Date: 2018/11/5
 * Time: 14:47
 */

namespace App\Service;


use App\Model\Imgs;
use App\Service\Activity\ActivityService;

class FileService extends BaseService
{


    public function getPath()
    {
        new ActivityService();
        $fileName = date('His').rand(0,99999).rand(0,99999);
        $path = 'upfile/ueditor/image/'.date('Y/m/d').'/'.$fileName.'{.suffix}';
        return $path;
    }


    /**
     * 设置图片
     * @return array
     * @author 张永辉 2018年11月6日
     */
    public function setFile()
    {
        $insertData = [
            'name'      => '',
            'cdn_path'  => $this->cdn_path,
            'type'      => $this->type,
            'img_size'  => $this->img_size,
            'file_mine' => $this->file_mine,
            'size'      => $this->size,
        ];
        $insertData['id'] = Imgs::insertGetId($insertData);
        return $insertData;
    }
}